Predicting a table of contents pointer value responsive to branching to a subroutine

ABSTRACT

Predicting a Table of Contents (TOC) pointer value responsive to branching to a subroutine. A subroutine is called from a calling module executing on a processor. Based on calling the subroutine, a value of a pointer to a reference data structure, such as a TOC, is predicted. The predicting is performed prior to executing a sequence of one or more instructions in the subroutine to compute the value. The value that is predicted is used to access the reference data structure to obtain a variable value for a variable of the subroutine.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of co-pending U.S. patent applicationSer. No. 15/708,223, filed Sep. 19, 2017, entitled “PREDICTING A TABLEOF CONTENTS POINTER VALUE RESPONSIVE TO BRANCHING TO A SUBROUTINE,”which is hereby incorporated herein by reference in its entirety.

BACKGROUND

One or more aspects relate, in general, to processing within a computingenvironment, and in particular, to facilitating such processing.

Many computing systems use a Global Offset Table (GOT) or a Table ofContents (TOC) to populate variables within source code. For instance, acompiler generates object code from source code, without knowing thefinal address or displacement of the code/data. Specifically, thecompiler generates object code that will access a variable addressreference data structure (e.g., a Global Offset Table or a Table ofContents) for variable values without knowing the final size of the datastructure or offsets/addresses of various data sections. Placeholdersfor this information are left in the object code and updated by alinker.

To access the GOT or TOC, a pointer is used. The pointer is typicallycomputed by a sequence of instructions. These instructions often dependon computed registers which are not always readily available in aprocessor. Consequently, accesses to variables that depend on the TOC(i.e., variables other than local variables) may be delayed.

SUMMARY

Shortcomings of the prior art are overcome and additional advantages areprovided through the provision of a computer-implemented method offacilitating processing within a computing environment. The methodincludes, for instance, calling a subroutine from a calling moduleexecuting on a processor. Based on calling the subroutine, a value of apointer to a reference data structure is predicted. The predicting isperformed prior to executing a sequence of one or more instructions inthe subroutine to compute the value. The value that is predicted is usedto access the reference data structure to obtain a variable value for avariable of the subroutine.

Computer program products and systems relating to one or more aspectsare also described and claimed herein. Further, services relating to oneor more aspects are also described and may be claimed herein.

Additional features and advantages are realized through the techniquesdescribed herein. Other embodiments and aspects are described in detailherein and are considered a part of the claimed aspects.

BRIEF DESCRIPTION OF THE DRAWINGS

One or more aspects are particularly pointed out and distinctly claimedas examples in the claims at the conclusion of the specification. Theforegoing and objects, features, and advantages of one or more aspectsare apparent from the following detailed description taken inconjunction with the accompanying drawings in which:

FIG. 1A depicts one example of a computing environment to incorporateand use one or more aspects of the present invention;

FIG. 1B depicts further details of a processor of FIG. 1A, in accordancewith one or more aspects of the present invention;

FIG. 1C depicts further details of one example of an instructionexecution pipeline used in accordance with one or more aspects of thepresent invention;

FIG. 1D depicts further details of one example of a processor of FIG.1A, in accordance with an aspect of the present invention;

FIG. 2 depicts one example of a Set TOC Register (STR) instruction, inaccordance with an aspect of the present invention;

FIG. 3 depicts one example of processing associated with a Set TOCRegister instruction, in accordance with an aspect of the presentinvention;

FIG. 4 depicts another example of processing associated with a Set TOCRegister instruction, in accordance with an aspect of the presentinvention;

FIG. 5 depicts yet another example of processing associated with a SetTOC Register instruction, in accordance with an aspect of the presentinvention;

FIGS. 6A-6B depict embodiments of verifying the setting of a TOCregister (also referred to herein as a TOC pointer register), inaccordance with an aspect of the present invention;

FIGS. 7A-7B depict other embodiments of verifying the setting of the TOCregister, in accordance with aspects of the present invention;

FIG. 8 depicts one embodiment of determining a TOC pointer value (alsoreferred to herein as a TOC value), in accordance with an aspect of thepresent invention;

FIG. 9 depicts one example of processing associated with predicting aTOC value responsive to a subroutine branch, in accordance with anaspect of the present invention;

FIG. 10 depicts one example of TOC value check insertion logic, inaccordance with an aspect of the present invention;

FIG. 11 depicts another example of processing associated with predictinga TOC value responsive to a subroutine branch, in accordance with anaspect of the present invention;

FIG. 12 depicts another example of TOC value check insertion logic, inaccordance with an aspect of the present invention;

FIG. 13 depicts another example of TOC value check insertion logic, inaccordance with an aspect of the present invention;

FIG. 14A depicts one example of a TOC pointer cache (also referred toherein as a TOC cache), in accordance with an aspect of the presentinvention;

FIG. 14B depicts one example of TOC cache insertion processing, inaccordance with an aspect of the present invention;

FIG. 15 depicts one example of TOC values assigned to dynamically sharedobjects, in accordance with an aspect of the present invention;

FIG. 16 depicts another example of a TOC cache, in accordance with anaspect of the present invention;

FIG. 17 depicts another example of TOC cache insertion processing, inaccordance with an aspect of the present invention;

FIG. 18 depicts one example of storing TOC values into a TOC trackingstructure, in accordance with an aspect of the present invention;

FIG. 19 depicts one example of a TOC referenced by a read-only TOCregister, in accordance with an aspect of the present invention;

FIGS. 20A-20C depict examples of Load TOC-Relative Long instructions, inaccordance with aspects of the present invention;

FIG. 21 depicts one example of a Load Address TOC-Relative Longinstruction, in accordance with an aspect of the present invention;

FIG. 22 depicts one example of a TOC add immediate shift instruction, inaccordance with an aspect of the present invention;

FIG. 23 depicts one example of an add TOC immediate shifted instruction,in accordance with an aspect of the present invention;

FIG. 24 depicts one embodiment of processing an instruction that mayinclude TOC operands, in accordance with an aspect of the presentinvention;

FIGS. 25-27 depicts embodiments of obtaining TOC operands for aninstruction, in accordance with aspects of the present invention;

FIG. 28 depicts one example of a compilation flow associated with usinga Set TOC Register instruction, in accordance with an aspect of thepresent invention;

FIG. 29 depicts one example of a static linker flow associated withusing a Set TOC Register instruction, in accordance with an aspect ofthe present invention;

FIG. 30 depicts one example of a compilation flow associated with usingTOC read-only registers, in accordance with an aspect of the presentinvention;

FIGS. 31A-31B depict one embodiment of facilitating processing within acomputing environment, in accordance with an aspect of the presentinvention;

FIG. 32A depicts another example of a computing environment toincorporate and use one or more aspects of the present invention;

FIG. 32B depicts further details of the memory of FIG. 32A;

FIG. 33 depicts one embodiment of a cloud computing environment; and

FIG. 34 depicts one example of abstraction model layers.

DETAILED DESCRIPTION

In accordance with an aspect of the present invention, the providing ofa pointer to a reference data structure, such as a Table of Contents(TOC) or a Global Offset Table (GOT), is facilitated. In one example, aSet TOC Register (STR) instruction is provided that loads a register (orother defined location) with a value used to access the TOC (e.g., apointer value). Although a TOC is referred to herein as an example, theaspects, features and techniques described herein are equally applicableto a GOT or other similar type structures.

TOC pointer value, TOC pointer, TOC value, and pointer to the TOC, asexamples, are used interchangeably herein. The TOC register holds a TOCpointer, and therefore, may be referred to herein as a TOC pointerregister or a TOC register.

Further, TOC pointer cache, TOC pointer tracking structure, TOC pointertable, etc. are also referred to herein as TOC cache, TOC trackingstructure, TOC table, etc., respectively. Similarly, reference datastructure pointer cache and reference data structure cache are usedinterchangeably herein. Others examples may also exist.

In a further aspect, sequences of instructions typically used to set aTOC register are replaced by a Set TOC Register instruction. As anexample, a sequence of instructions includes one or more instructions.Further, a verify operation may be used to verify the TOC registervalue. A TOC register may be, for instance, a hardware register, or anarchitected register, such as a general purpose register (e.g., r2,r12), defined by an architecture or specified by an Application BinaryInterface (ABI). Other examples are possible.

In yet a further aspect, the TOC pointer value is predicted responsiveto branching to a subroutine.

In still a further aspect, embodiments of a TOC cache are provided tofacilitate processing. A TOC cache (or other reference data structurecache) is, for instance, a high-speed in-processor cache that includesvarious TOC pointer values to be predicted for differentlocations/modules in the program that have recently been used.

Yet further, an aspect is provided to prepare and initialize a TOCtracking structure for TOC pointer value prediction. A TOC trackingstructure may be, for instance, a TOC cache or an in-memory tablepopulated with TOC pointer values to be predicted for differentlocation/modules in the program.

In a further aspect, a pseudo-register (also referred to herein as aread-only TOC register) is used to provide the pointer value, along withTOC register addressing modes. The pseudo-register is not a hardware orarchitected register, nor does it have storage associated therewith;instead, it is a TOC pointer value obtained, e.g., from a TOC cache(e.g., the value that would have been produced by STR).

Moreover, in a further aspect, code is generated and/or compiled with aSet TOC Register instruction and/or to use read-only TOC registers.

Various aspects are described herein. Further, many variations arepossible without departing from a spirit of aspects of the presentinvention. It should be noted that, unless otherwise inconsistent, eachaspect or feature described herein and variants thereof may becombinable with any other aspect or feature.

One embodiment of a computing environment to incorporate and use one ormore aspects of the present invention is described with reference toFIG. 1A. In one example, the computing environment is based on thez/Architecture, offered by International Business Machines Corporation,Armonk, N.Y. One embodiment of the z/Architecture is described in“z/Architecture Principles of Operation,” IBM Publication No.SA22-7832-10, March 2015, which is hereby incorporated herein byreference in its entirety. Z/ARCHITECTURE is a registered trademark ofInternational Business Machines Corporation, Armonk, N.Y., USA.

In another example, the computing environment is based on the PowerArchitecture, offered by International Business Machines Corporation,Armonk, N.Y. One embodiment of the Power Architecture is described in“Power ISA™ Version 2.07B,” International Business Machines Corporation,Apr. 9, 2015, which is hereby incorporated herein by reference in itsentirety. POWER ARCHITECTURE is a registered trademark of InternationalBusiness Machines Corporation, Armonk, N.Y., USA.

The computing environment may also be based on other architectures,including, but not limited to, the Intel x86 architectures. Otherexamples also exist.

As shown in FIG. 1A, a computing environment 100 includes, for instance,a computer system 102 shown, e.g., in the form of a general-purposecomputing device. Computer system 102 may include, but is not limitedto, one or more processors or processing units 104 (e.g., centralprocessing units (CPUs)), a memory 106 (referred to as main memory orstorage, as examples), and one or more input/output (I/O) interfaces108, coupled to one another via one or more buses and/or otherconnections 110.

Bus 110 represents one or more of any of several types of busstructures, including a memory bus or memory controller, a peripheralbus, an accelerated graphics port, and a processor or local bus usingany of a variety of bus architectures. By way of example, and notlimitation, such architectures include the Industry StandardArchitecture (ISA), the Micro Channel Architecture (MCA), the EnhancedISA (EISA), the Video Electronics Standards Association (VESA) localbus, and the Peripheral Component Interconnect (PCI).

Memory 106 may include, for instance, a cache 120, such as a sharedcache, which may be coupled to local caches 122 of processors 104.Further, memory 106 may include one or more programs or applications130, an operating system 132, and one or more computer readable programinstructions 134. Computer readable program instructions 134 may beconfigured to carry out functions of embodiments of aspects of theinvention.

Computer system 102 may also communicate via, e.g., I/O interfaces 108with one or more external devices 140, one or more network interfaces142, and/or one or more data storage devices 144. Example externaldevices include a user terminal, a tape drive, a pointing device, adisplay, etc. Network interface 142 enables computer system 102 tocommunicate with one or more networks, such as a local area network(LAN), a general wide area network (WAN), and/or a public network (e.g.,the Internet), providing communication with other computing devices orsystems.

Data storage device 144 may store one or more programs 146, one or morecomputer readable program instructions 148, and/or data, etc. Thecomputer readable program instructions may be configured to carry outfunctions of embodiments of aspects of the invention.

Computer system 102 may include and/or be coupled toremovable/non-removable, volatile/non-volatile computer system storagemedia. For example, it may include and/or be coupled to a non-removable,non-volatile magnetic media (typically called a “hard drive”), amagnetic disk drive for reading from and writing to a removable,non-volatile magnetic disk (e.g., a “floppy disk”), and/or an opticaldisk drive for reading from or writing to a removable, non-volatileoptical disk, such as a CD-ROM, DVD-ROM or other optical media. Itshould be understood that other hardware and/or software componentscould be used in conjunction with computer system 102. Examples,include, but are not limited to: microcode, device drivers, redundantprocessing units, external disk drive arrays, RAID systems, tape drives,and data archival storage systems, etc.

Computer system 102 may be operational with numerous other generalpurpose or special purpose computing system environments orconfigurations. Examples of well-known computing systems, environments,and/or configurations that may be suitable for use with computer system102 include, but are not limited to, personal computer (PC) systems,server computer systems, thin clients, thick clients, handheld or laptopdevices, multiprocessor systems, microprocessor-based systems, set topboxes, programmable consumer electronics, network PCs, minicomputersystems, mainframe computer systems, and distributed cloud computingenvironments that include any of the above systems or devices, and thelike.

Further details regarding one example of processor 104 are describedwith reference to FIG. 1B. Processor 104 includes a plurality offunctional components used to execute instructions. These functionalcomponents include, for instance, an instruction fetch component 150 tofetch instructions to be executed; an instruction decode unit 152 todecode the fetched instructions and to obtain operands of the decodedinstructions; instruction execution components 154 to execute thedecoded instructions; a memory access component 156 to access memory forinstruction execution, if necessary; and a write back component 160 toprovide the results of the executed instructions. One or more of thesecomponents may, in accordance with an aspect of the present invention,be used to execute one or more instructions and/or operations associatedwith Table of Contents (TOC) pointer processing 166.

Processor 104 also includes, in one embodiment, one or more registers168 to be used by one or more of the functional components. Processor104 may include additional, fewer and/or other components than theexamples provided herein.

Further details regarding an execution pipeline of processor 104 aredescribed with reference to FIG. 1C. Although various processing stagesof the pipeline are depicted and described herein, it will be understoodthat additional, fewer and/or other stages may be used without departingfrom the spirit of aspects of the invention.

Referring to FIG. 1C, in one embodiment, an instruction is fetched 170from an instruction queue, and branch prediction 172 and/or decoding 174of the instruction may be performed. The decoded instruction may beadded to a group of instructions 176 to be processed together. Thegrouped instructions are provided to a mapper 178 that determines anydependencies, assigns resources and dispatches the group ofinstructions/operations to the appropriate issue queues. There are oneor more issue queues for the different types of execution units,including, as examples, branch, load/store, floating point, fixed point,vector, etc. During an issue stage 180, an instruction/operation isissued to the appropriate execution unit. Any registers are read 182 toretrieve its sources, and the instruction/operation executes during anexecute stage 184. As indicated, the execution may be for a branch, aload (LD) or a store (ST), a fixed point operation (FX), a floatingpoint operation (FP), or a vector operation (VX), as examples. Anyresults are written to the appropriate register(s) during a write backstage 186. Subsequently, the instruction completes 188. If there is aninterruption or flush 190, processing may return to instruction fetch170.

Further, in one example, coupled to the decode unit is a registerrenaming unit 192, which may be used in the saving/restoring ofregisters.

Additional details regarding a processor are described with reference toFIG. 1D. In one example, a processor, such as processor 104, is apipelined processor that may include prediction hardware, registers,caches, decoders, an instruction sequencing unit, and instructionexecution units, as examples. The prediction hardware includes, forinstance, a local branch history table (BHT) 105 a, a global branchhistory table (BHT) 105 b, and a global selector 105 c. The predictionhardware is accessed through an instruction fetch address register(IFAR) 107, which has the address for the next instruction fetch.

The same address is also provided to an instruction cache 109, which mayfetch a plurality of instructions referred to as a “fetch group”.Associated with instruction cache 109 is a directory 111.

The cache and prediction hardware are accessed at approximately the sametime with the same address. If the prediction hardware has predictioninformation available for an instruction in the fetch group, thatprediction is forwarded to an instruction sequencing unit (ISU) 113,which, in turn, issues instructions to execution units for execution.The prediction may be used to update IFAR 107 in conjunction with branchtarget calculation 115 and branch target prediction hardware (such as alink register prediction stack 117 a and a count register stack 117 b).If no prediction information is available, but one or more instructiondecoders 119 find a branch instruction in the fetch group, a predictionis created for that fetch group. Predicted branches are stored in theprediction hardware, such as in a branch information queue (BIQ) 125,and forwarded to ISU 113.

A branch execution unit (BRU) 121 operates in response to instructionsissued to it by ISU 113. BRU 121 has read access to a condition register(CR) file 123. Branch execution unit 121 further has access toinformation stored by the branch scan logic in branch information queue125 to determine the success of a branch prediction, and is operativelycoupled to instruction fetch address register(s) (IFAR) 107corresponding to the one or more threads supported by themicroprocessor. In accordance with at least one embodiment, BIQ entriesare associated with, and identified by an identifier, e.g., by a branchtag, BTAG. When a branch associated with a BIQ entry is completed, it isso marked. BIQ entries are maintained in a queue, and the oldest queueentries are de-allocated sequentially when they are marked as containinginformation associated with a completed branch. BRU 121 is furtheroperatively coupled to cause a predictor update when BRU 121 discovers abranch misprediction.

When the instruction is executed, BRU 121 detects if the prediction iswrong. If so, the prediction is to be updated. For this purpose, theprocessor also includes predictor update logic 127. Predictor updatelogic 127 is responsive to an update indication from branch executionunit 121 and configured to update array entries in one or more of thelocal BHT 105 a, global BHT 105 b, and global selector 105 c. Thepredictor hardware 105 a, 105 b, and 105 c may have write ports distinctfrom the read ports used by the instruction fetch and predictionoperation, or a single read/write port may be shared. Predictor updatelogic 127 may further be operatively coupled to link stack 117 a andcount register stack 117 b.

Referring now to condition register file (CRF) 123, CRF 123 isread-accessible by BRU 121 and can be written to by the execution units,including but not limited to, a fixed point unit (FXU) 141, a floatingpoint unit (FPU) 143, and a vector multimedia extension unit (VMXU) 145.A condition register logic execution unit (CRL execution) 147 (alsoreferred to as the CRU), and special purpose register (SPR) handlinglogic 149 have read and write access to condition register file (CRF)123. CRU 147 performs logical operations on the condition registersstored in CRF file 123. FXU 141 is able to perform write updates to CRF123.

Processor 104 further includes, a load/store unit 151, and variousmultiplexors 153 and buffers 155, as well as address translation tables157, and other circuitry.

Processor 104 executes programs (also referred to as applications) thatinclude variables. A variable has an identifier (e.g., name) and refersto a storage location that includes a value (e.g., information, data).During runtime, a program determines addresses of the variables, whichwere not known at compile time, by using the TOC.

When a subroutine is called, the subroutine establishes its own TOCbecause if it is in a different module than the function that called it,it will have its own data dictionary (i.e., TOC) and a pointer to thatdictionary is to be established. Establishing such a pointer isexpensive.

One example of code used to establish a TOC pointer is shown below,e.g., with reference to an example ABI, such as the Open POWER ELFv2ABI.

In accordance with one such example embodiment, the caller initializesone or more registers with the address of the called function, e.g., inaccordance with an ABI.

In the following example, two registers, r12 and ctr, are initializedwith the address of the called function:

... ld r12, <...> // Load r12 mtctr r12 // Move value of r12 to CTRbctrl // Branch to CTR nop ...

In accordance with an established ABI, the called function initializes aTOC pointer. A variety of implementations exist. In one embodiment, theentry address from the one or more registers initialized by the calleris used, when the address function is called via a register-indirectcall. For example, in accordance with an example ABI, such as the OpenPOWER ELFv2 ABI, the TOC pointer register, r2, may be initialized asfollows using the callee's function entry address loaded into r12 by thecaller by the function called “foo”:

_foo:   // skip the next 2 instructions when _foo is called from localmodule   .localentry _foo, 2   // Add distance from _foo to the TOCpointer value .TOC.   addis r2, r12, #higha (_foo - .TOC.) // add higherbits of offset to r12 // place result in r2 // r2 is the TOC register  addi r2, r2, #low (_foo - .TOC.) // add lower bits of offset to r2 //store result in r2   // Local entry point coincides with start oftraditional function   prologue    ...

In accordance with an aspect of the present invention, instead ofdetermining the TOC pointer using, for instance, the code above, whichis expensive in many microprocessor implementations, a Set TOC Register(STR) instruction is used. The Set TOC Register instruction loads aregister (or other defined location) with a value of a pointer to theTOC, e.g., by performing a look-up in the processor. Since the TOC isshared by all (or a set) of functions of a module, only a small numberof TOC register values are to be remembered and associated with a rangeof addresses. As examples, the Set TOC Register instruction may beimplemented as an architected hardware instruction or an internaloperation.

One example of a Set TOC Register (STR) instruction is described withreference to FIG. 2. In one example, a Set TOC Register instruction 200includes an operation code (opcode) field 202 that includes an operationcode indicating a set TOC register operation, and a target register (RT)field 204 specifying a location, such as a register, to receive thevalue of the TOC pointer.

Although, in this example, one opcode field is shown, in otherembodiments, there may be a plurality of opcode fields. Other variationsare also possible.

As indicated, in one example, target register field 204 identifies aregister to be loaded with a TOC pointer value. The STR instructionloads the register specified by field 204 with the value of the TOCpointer for a present code sequence, in which the code sequencecorresponds to code following the address of the STR instruction.

There are a variety of possible implementations of processing associatedwith the STR instruction including, for instance, a softwareimplementation, a hardware-assisted implementation, and a hardwareimplementation. In the software implementation, based on executing theSTR instruction, an exception is raised and the setting of the TOCregister is emulated by supervisor code (e.g., the operating system orhypervisor) or by a user-mode interrupt handler (e.g., using anevent-based branch facility in accordance with a definition of the PowerArchitecture). In the hardware-assisted implementation, the hardwareprovides a cache (e.g., a small table or other data structure to storemost frequently used values) or predictor for frequent values and trapsto the software. The supervisor code or user-mode interrupt handler thenprocesses the instruction, as described above. In the hardwareimplementation, the hardware provides a cache or predictor for frequentvalues, and based on a miss in the cache, looks up a table (or otherdata structure that has been populated in software with the TOC pointervalues). Further details regarding the implementation choices aredescribed with reference to FIGS. 3-5.

One implementation that uses software, e.g., supervisor code oruser-mode interrupt handler, is described with reference to FIG. 3.Referring to FIG. 3, in one example, the STR instruction is received bya processor, STEP 300, and a trap is raised to a handler routine, suchas a supervisor (e.g., the operating system (OS) or a hypervisor (HV)),or user-mode interrupt code, STEP 310. The handler routine is entered,STEP 320, and the handler looks up, e.g., in a cache or table, the TOCpointer value for the function corresponding to the address of the STRinstruction, STEP 330. The obtained TOC value is loaded in the targetregister of the STR instruction, STEP 340. Thereafter, processingreturns to the code after the STR instruction to continue executing withthe obtained TOC value, STEP 350.

Another implementation is described with reference to FIG. 4, in which ahardware-assisted implementation is described. Referring to FIG. 4, anSTR instruction is received by a processor, STEP 400, and a TOC cachelook-up is performed to locate the TOC value for the function thatincludes the STR instruction, STEP 402. A determination is made as towhether a TOC cache entry for the function was found, INQUIRY 404. Ifthe TOC cache entry is found, then the STR target register is loadedwith the result from the TOC cache look-up, STEP 406. Otherwise, a trapis raised to the handler routine, as described above, STEP 408. Forinstance, the handler routine is entered, STEP 410, and a look-up isperformed, e.g., in a table, for the TOC value for the functioncorresponding to the address of the STR instruction, STEP 412. The TOCcache is loaded with the TOC value, STEP 414, and the target register ofthe STR instruction is loaded with the obtained TOC value, STEP 416.Processing then returns to the instruction after the STR instruction tocontinue executing with the obtained TOC value, STEP 418.

A further implementation is described with reference to FIG. 5, in whichhardware performs the processing. Referring to FIG. 5, an STRinstruction is received, STEP 500, and a TOC cache look-up is performedto locate the TOC value for the function that includes the STRinstruction, STEP 502. A determination is made as to whether a TOC cacheentry for the function is found, INQUIRY 504. If the TOC cache entry isfound, then the STR target register is loaded with the result from theTOC cache look-up, STEP 506. However, if the TOC cache entry is notfound, then TOC cache miss handling logic is performed, STEP 510. Thisincludes, for instance, determining a look-up table start, STEP 512, andlooking up in one or more tables or other data structures the TOC valuefor the function corresponding to the address of the STR, STEP 514. TheTOC cache is loaded with the found TOC value (e.g., address), STEP 516,and the target register of the STR is loaded with the obtained TOCvalue, STEP 518.

In one or more of the above examples, the TOC cache may be implementedin a number of ways. For instance, it may include a pair (STR address,returned value) associating a value to return for the address of eachSTR instruction, or it may include a range of addresses of STRinstructions for which to return a specified value, since adjacentfunctions typically share a TOC, e.g., storing a triple (from_range,to_range, returned value) in a table. Further details regarding TOCcaches are described below.

Although in the above-described embodiments, the STR is used to load aTOC value, the STR may also be used to load other values, such as amagic number (e.g., identifier in, e.g., the Executable and LinkableFormat (ELF)), or other values, e.g., those which may be associated witha region of code, specific modules, or particular instruction addressesof an STR instruction. Many possibilities exist.

In a further aspect, code is scanned looking for instruction sequencesthat set the value of a TOC register and those instruction sequences arereplaced with a Set TOC Register instruction. In yet a further aspect, averification instruction is provided to verify prediction of the valueof the TOC register. As examples, an instruction sequence includes oneor more instructions.

In accordance with conventional code generation techniques, TOC valuesare often computed using a sequence of instructions, or loaded from thestack.

For instance, a TOC value may be computed using a sequence such as:

addis r2, r12, offset@h // add immediate shift; r12 is the // beginningof the function; r2 // is a register to hold the TOC // value; highorder bits of offset // are added to the beginning of // the functionand the result is // placed in r2 addi r2, r2, offset@l // addimmediate; add the lower // order bits of the offset to the // value inr2; place the result in r2

In another example, a TOC value is loaded (ld) from memory (e.g., astack):

-   -   ld r2, sp, <stackoffset for TOC>// sp is stack pointer

These sequences commonly involve interlocks (e.g., need to wait on aprevious store instruction directed at storing the TOC value tocomplete), before they may complete. This type of interlock commonlyresults in performance degradation. Thus, in accordance with an aspectof the present invention, a processor instruction decode unit recognizesTOC-setting instructions and/or TOC-setting instruction sequences andreplaces them with an STR instruction. Optionally, a verificationinstruction is also provided. As used herein, a TOC-setting instructionand/or TOC-setting instruction sequence includes one or moreinstructions used to set a TOC register or compute a TOC pointer value.

For example, in one embodiment, the following instruction sequence isrecognized by the processor (e.g., the instruction decode unit of theprocessor):

addis r2, r12, offset@h addi r2, r2, offset@Iand the sequence is replaced with the following operations to load a(predicted) TOC value and verify the prediction by comparing it to thesum of the register r12 and offset used in the original code to computer2:

STR r2 verify r2, r12, offset

In a further example:

ld r2, sp, <stackoffset for TOC>

is replaced with:

STR r2 load-verify r2, sp, <stackoffset>

Examples of the STR instruction are described above, and further detailsregarding using the verify operations are described below. For instance,further details associated with using an STR verify internal operation(iop), e.g., verify rx, ry, offset, are described with reference to FIG.6A.

Referring to FIG. 6A, a verification technique, performed by, e.g., aprocessor, is described. Initially, a verify internal operation (e.g.,an internal operation verify rx, ry, offset with two example registeroperands and an immediate number operand—such as the example verify r2,r12, offset in the example code hereinabove) is received, STEP 600. Avariable a is computed by adding the offset of the verify operation to avalue of base register ry of the verify internal operation (e.g., r12),STEP 602. A determination is made as to whether a value in the targetregister, rx of the verify internal operation (e.g., r2), is equal tothe computed value, a, INQUIRY 604. If the value of rx is equal to thecomputed value, a, the verification is complete, STEP 606, andsuccessful.

However, if the value of rx is unequal to a, then a is assigned to thetarget register rx, STEP 608, and recovery is initiated, STEP 610.Recovery includes, for instance, flushing incorrect uses of rx from theinstruction pipeline after the present instruction or flushing allinstructions in the pipeline after the present instruction. Othervariations are also possible.

In a further embodiment, as shown in FIG. 6B, the computed value (e.g.,the TOC pointer; a.k.a., the TOC pointer address or address) is loadedin the TOC cache, STEP 620.

Other examples of verification techniques performed, e.g., by aprocessor, are described with reference to FIGS. 7A-7B. Referring toFIG. 7A, in one example, a load-verify internal operation is received,STEP 700. A value for a variable a is computed. For instance, a value atthe memory address ry (i.e., at the stack pointer) plus an offset isassigned to variable a, STEP 702. A determination is made as to whetherthe value of a base register rx (e.g., r2) is equal to a, INQUIRY 704.If the value in rx is equal to the computed value a, then theverification is complete and successful, STEP 706. However, if thecomputed value a is not equal to the value in rx, then a is assigned torx, STEP 708. Further, recovery is initiated, STEP 710. Recoveryincludes, for instance, flushing the incorrect uses of rx or flushingall instructions in the pipeline after the present instruction. Othervariations are possible.

In another embodiment, with reference to FIG. 7B, the computed value(e.g., the TOC pointer or address) is loaded into the TOC cache, STEP720.

In a further embodiment, different execution paths may be takendepending on whether the TOC value is in the TOC cache. One example ofthis processing is performed by e.g., a processor, and is described withreference to FIG. 8. Initially, a determination is made as to whetherthere is an opportunity to replace instruction sequences used todetermine the TOC value (e.g., an opportunity to fuse multipleinstructions into an iop sequence), INQUIRY 800. That is, is there anopportunity to replace sequences of instructions with an STR, andoptionally, a verify, or to perform some other replacement ofinstructions? If not, then conventional processing is performed todetermine the TOC value (e.g., using the sequence of instructionsaddis/addi or a load instruction), STEP 802. However, if there is a TOCvalue replace opportunity, then a look-up is performed in the TOC cacheto determine whether a value for the routine including the STR is there,STEP 804. If there is a TOC cache hit, then the target register of STRis updated with the TOC value, STEP 808. Further, verification isperformed, in one example, STEP 810. However, returning to INQUIRY 806,if there is not a TOC cache hit, then the TOC value is generated eitherby a sequence of compute instructions (e.g., addis, addi) or a loadinstruction, as examples, STEP 812. The computed value is loaded intothe TOC cache, STEP 814, and the target register is updated, STEP 816.

Other implementations and variations are also possible.

In a further aspect, the TOC value is predicted based on entering asubroutine. For instance, when a subroutine call is performed, the TOCvalue is predicted, rather than waiting to find a sequence ofinstructions that is believed to compute the TOC value. Instead, the TOCvalue is predicted upon entering the subroutine, and then, when thesequence of instructions in the called routine that computes the TOCvalue is encountered, it is replaced by a TOC checking instruction(i.e., an instruction that checks or verifies the predicted TOC value).If the TOC checking instruction fails, or a TOC value is accessedwithout the prediction having been checked, recovery may be performed.

As one example, the processor predicts the value of the TOC register(e.g., r2) for a subroutine based on previously observed addresses. Thepredicted TOC value is entered into a target address register array inconjunction with a predicted target address or in a separate TOCprediction array, as examples.

In particular embodiments, the TOC value may be predicted using, forinstance, the hardware-assisted technique described with reference toFIG. 4, and/or the hardware technique described with reference to FIG.5. In a further embodiment, the TOC value is obtained by using thesequence of instructions in legacy code to compute the TOC value andinitializing the TOC cache. Other possibilities also exist.

One embodiment of predicting the TOC value based on a subroutine branchis described with reference to FIG. 9. This processing is performed by,e.g., a processor. Referring to FIG. 9, initially, a determination ismade as to whether the subroutine call is a candidate for predicting theTOC value, INQUIRY 900. For instance, is the subroutine call aregister-indirect branch (in which a location of the address of the nextinstruction to execute is specified in a branch instruction, instead ofthe address itself)? In other embodiments, branches other thanlocal-module functions are considered candidates, or filters or othermechanisms may be provided to determine candidacy. If not, thenconventional processing is performed, STEP 902. However, if thesubroutine call is a candidate for predicting the TOC value, then thesubroutine call is performed, STEP 904. This call may be coupled withprediction of other types of values, in addition to the TOC value.Additionally, the old TOC value is saved in, for instance, a recoverylocation, such as a register, TOCRECOVER, STEP 906. Further, the TOCvalue is predicted, STEP 908. Various techniques may be used to predictthe TOC value, as described herein. The predicted TOC value is thenloaded into a TOC pointer register (e.g., r2), STEP 910. Theidentification of the TOC register may be hardcoded or may beconfigured, as examples. Further, in one example, a flag or otherindicator maintained in a selected location is set (e.g., to 1) toindicate a TOC check (e.g., a check of the TOC value) is to be performedbefore use of the TOC value, STEP 912.

Further details regarding a TOC check, and in particular, insertionlogic for the TOC check, are described with reference to FIG. 10. In oneexample, this logic is integrated in the decode unit. Initially, aninstruction is obtained and decoded, STEP 1000. A determination is madeas to whether the TOC check flag is set, INQUIRY 1002. If it is not set,then this processing is complete. However, if the TOC check flag is set(e.g., set to 1), then a further determination is made as to whether thecurrent instruction corresponds to a TOC setting instruction (e.g., asequence of one or more instructions to set (e.g., load, store, provide,insert, place) the TOC value in, e.g., a TOC register; e.g., a loadinstruction, or a sequence of instructions to compute the TOC value),INQUIRY 1004. If the current instruction corresponds to a TOC settinginstruction, then the TOC check is inserted in the code, STEP 1006. Forinstance, an STR verify or an STR load-verify instruction replaces theone or more instructions in the code used to compute the TOC value. Theparameters of a verify instruction are, e.g., derived from the computesequences being replaced, e.g., based on the examples shown hereinabove.Thus, an instruction sequence based on computation instructions may bereplaced with a verify instruction computing the address similar to thecomputational instruction(s), e.g., replacing one or more addinstructions with a verify computing the instruction using correspondingadditions; and load instructions may be replaced with load-verifyinstructions obtaining the value to be compared against from the samelocation(s) wherefrom a replaced load instruction would have loaded aTOC register. Additionally, the TOC check flag is turned off (e.g., setto 0), STEP 1008.

Returning to INQUIRY 1004, if the current instruction does notcorrespond to a TOC setting instruction, then a further determination ismade as to whether the current instruction corresponds to a TOC useinstruction (i.e., one or more of instructions to use the TOC value orTOC register), INQUIRY 1010. If not, then processing is complete.Otherwise, recovery may be performed, STEP 1012. In one embodiment, thiscan be accomplished by copying the value in TOCRECOVER back into the TOCregister (e.g., r2). In another embodiment, register renaming may beused. In this embodiment, the predicted TOC value is stored in a newrename register, and during recovery, the new rename register isinvalidated or the old TOC value is copied from another rename registerto the new rename register. Other implementations and/or embodiments arealso possible.

Another embodiment of predicting a TOC value based on a subroutinebranch is described with reference to FIG. 11. This processing isperformed by, e.g., a processor. Referring to FIG. 11, initially, adetermination is made as to whether the subroutine call is a candidatefor predicting the TOC value, INQUIRY 1100. In one embodiment,register-indirect branches are predicted. In other embodiments,module-local functions are excluded, and/or filters may further suppresscandidate status, either based on an address called; or a calleraddress, callee address pair. Other possibilities also exist. If thesubroutine call is not a candidate, then conventional processing isperformed, STEP 1102.

Returning to INQUIRY 1100, if the subroutine call is a candidate forpredicting the TOC value, then the subroutine call is made, STEP 1104.Optionally, other affiliated values may be predicted, in addition to theTOC value. Further, the old TOC value is saved in, for instance, arecovery register, TOCRECOVER, STEP 1106. Then, an attempt is made topredict the TOC value using the TOC cache, STEP 1108. A determination ismade as to whether there was a TOC cache hit, INQUIRY 1110. If there wasa TOC cache hit, then the obtained TOC value is loaded into the TOCpointer register (e.g., r2), STEP 1112. Further, a TOC check flag is set(e.g., to 1) indicating a TOC value check is to be performed prior touse of the predicted TOC value, and in one embodiment, a TOC captureflag located in a select location is turned off (e.g., set to 0), STEP1114. Returning to INQUIRY 1110, if there is a TOC cache miss, then theTOC capture flag is set to indicate a TOC capture (e.g., set to 1) is tobe performed to obtain the TOC value, and the TOC check flag is turnedoff (e.g., set to 0), STEP 1116. Other variations are also possible.

Details regarding check insertion logic for the embodiment of FIG. 11are described with reference to FIG. 12. In one embodiment, this logicis integrated into the decode unit. Initially, an instruction isobtained and decoded, STEP 1200. A determination is made as to whetherthe current instruction corresponds to a TOC setting instruction,INQUIRY 1202. If it does not correspond to a TOC setting instruction,then a determination is made as to whether the current instructioncorresponds to a TOC use instruction, INQUIRY 1204. If not, thenprocessing is complete. Otherwise, a further determination is made as towhether the TOC check flag is set, INQUIRY 1206. If not, then againprocessing is complete. Otherwise, recovery may be performed, STEP 1208.In one embodiment, the recovery includes copying the value in theTOCRECOVER register back into the TOC register (e.g., r2) or usingrename registers, as described above. Other variations are possible.

Returning to INQUIRY 1202, if the current instruction corresponds to aTOC setting instruction, then the check is inserted into the code, STEP1210. For instance, an STR verify or an STR load-verify is inserted. TheTOC check flag is then turned off (e.g., set to 0), STEP 1212.

A further embodiment of TOC check insertion logic is described withreference to FIG. 13. In one example, this logic is integrated into thedecode unit. Referring to FIG. 13, an instruction is obtained anddecoded, STEP 1300. A determination is made as to whether the currentinstruction corresponds to a TOC setting instruction, INQUIRY 1302. Ifthe current instruction does not correspond to a TOC settinginstruction, then a further determination is made as to whether thecurrent instruction corresponds to a TOC use instruction, INQUIRY 1304.If not, then processing ends. Otherwise, a determination is made as towhether the TOC capture flag is set, INQUIRY 1306. If not, thenprocessing is complete. Otherwise, the TOC capture flag is turned off(e.g., set to 0), STEP 1308. In one embodiment, it can be recorded thatthis function does not load a new TOC value in the TOC cache, or afilter is indicated (e.g., Bloom filter) to suppress TOC prediction withthe TOC cache. Other variations are also possible.

Returning to INQUIRY 1302, if the current instruction does notcorrespond to a TOC setting instruction, then the check is inserted,which in one example includes a verify instruction that triggersrecovery actions, STEP 1310, and the TOC capture flag is reset (e.g.,set to 0), STEP 1312.

In one embodiment, the processing associated with the TOC check flag andthe TOC capture flag may be performed, and in one example, they may beperformed in parallel.

Further details regarding a TOC cache are now described with referenceto FIG. 14A. In one example, a TOC cache 1400 includes a plurality ofcolumns, including e.g., a TOC setter address column 1402, a TOC valuecolumn 1404 that includes the TOC value for the module of that entry, anoptional function initializes TOC column 1406, and an optional usagetracking column 1408. TOC setter address column 1402 includes a TOCsetter address, such as the address of the STR, the function begin, or anumber of other values, based on specific use cases. In one or moreembodiments, there are provided set associative tables that are accessedby TOC setter addresses. The FUNC inits TOC column 1406 may be used tocapture functions that do not initialize a TOC register. In anotherembodiment, using a table entry is too expensive, and a filteringmechanism, e.g., a Bloom filter, or other filter mechanisms may be usedto identify functions for which a TOC value should not be predicted.Usage tracking provides a way of selecting an entry to be removed whenthe table is full and another entry is to be used. A variety of trackingschemes may be used, including, for instance, least recently used, leastfrequently used, FIFO (first in, first out), number of uses per timeperiod, etc. In at least one embodiment, column 1408 is adapted to storeusage information commensurate for storing the appropriate informationfor an implemented replacement policy.

One embodiment of inserting an entry into the TOC cache is describedwith reference to FIG. 14B. Initially, a value pair (e.g., callee, TOCvalue) to be entered into the TOC cache is received, STEP 1450. An entryin the cache is selected for storing the value pair, STEP 1452. Asexamples, index bits may be used to select the entry or the usagetracking information may be used. Optionally, in one embodiment, if anentry is to be evicted, the evicted entry is saved, e.g., to a secondlevel TOC cache, STEP 1454. The obtained value pair is stored in theselected entry, STEP 1456. Other variations are possible.

In one embodiment, a single TOC pointer value corresponds to an entiremodule, i.e., all functions in a module have the same TOC pointer value.Therefore, in accordance with an aspect of the present invention, theprocessor stores a TOC value in a TOC cache for a range of addresses. Asan example, the range of addresses corresponding to the same TOC pointervalue is dynamically determined, e.g., by coalescing newly discoveredvalues of the TOC with pre-existing ranges. In a further embodiment, theextent of the ranges is provided by the dynamic loader, and a predictedTOC value is associated with the value of the range. Other examples arealso possible.

As a further example, the TOC may cover a portion of a module, and then,the range of addresses would be the range of that portion. Othervariations also exist.

The TOC cache may be used, as described above, but in this aspect, theTOC cache has a different format than in FIG. 14A, and therefore,different management. This enables a more compact and efficientrepresentation of a TOC cache, which takes advantage of the TOC valueproperties.

As shown in FIG. 15, in one example, an application 1500 may include aplurality of modules, including a main program 1502 and one or moredynamically shared objects (DSOs) 1504, such as shared libraries. Eachmodule has associated therewith a TOC value 1506, which corresponds tocode in the address range to which that module has been loaded, e.g., bythe dynamic loader. Since each module may have its own TOC valueassociated therewith, the TOC cache may be implemented indicating such.For instance, as shown in FIG. 16, a TOC cache 1600 includes, forinstance, a TOC range address_from column 1602 and a TOC rangeaddress_to column 1604. TOC range address_from column 1602 shows thestart of a particular module for a TOC value, and TOC range address_tocolumn 1604 shows the end of that particular module for the TOC value.For that module, a TOC value is included in a TOC value column 1606.Further, the TOC cache may include a usage tracking column 1608. Otherand/or different columns are also possible.

One embodiment of inserting an entry in such a TOC cache is describedwith reference to FIG. 17. This logic is performed by, for instance, theprocessor. A value pair (e.g., callee, TOC value) to be inserted intothe cache is received, STEP 1700. An attempt is made to select an entryfor storing the TOC value based on the indicated TOC value, STEP 1702. Adetermination is made as to whether an entry is found in the TOC cachefor the TOC value, INQUIRY 1704. If no entry is found, then an entrywithin the TOC cache is selected for storing the TOC value, STEP 1706.This entry may be an empty entry or it may be an entry that has otherinformation. If there is already a value in the entry to be used, thenthat information may be saved, for instance, in a second level TOCcache, STEP 1708. The received value is then stored in the selectedentry, STEP 1710. Additionally, the address_from and address_to columnsare set to the callee address.

Returning to INQUIRY 1704, if an entry is found, then a determination ismade as to whether the callee address is less than the address in theaddress_from column, INQUIRY 1720. If the callee address is less thanthe address_from column, then the address_from column of the selectedentry is updated to the callee address, STEP 1722. Otherwise, theaddress_to column of the selected entry is updated to the calleeaddress, STEP 1724.

The above flow assumes one entry per TOC value such that there are notmultiple entries found. However, if multiple entries could be found fora particular module, then a check for such would be made.

In a further embodiment, candidate selection for TOC prediction may usethe TOC table with ranges to determine whether a call to the same moduleis performed to suppress TOC prediction. Other variations are possible.

In a further aspect, a TOC tracking structure is prepared andinitialized for TOC prediction. As one example, a linker links a programand the linker determines a TOC value, either an absolute value for amodule or a relative offset, e.g., relative to a module load address.The dynamic loader loads the module and computes the final TOC value.The dynamic loader then loads the TOC value into a TOC trackingstructure to be used in connection with, for instance, the Set TOCRegister instruction or another predictive instruction.

As examples, the TOC tracking structure may be the TOC cache itself orit may be an in-memory table representation. Other examples are alsopossible. Further, details associated with storing TOC values into thetracking structure are described with reference to FIG. 18. Thisprocessing is performed by, for instance, a loader.

Referring to FIG. 18, the loader receives a request to load a module,STEP 1800, and computes at least one TOC pointer for the loaded module,STEP 1802. That TOC value is stored in a TOC tracking structure, e.g.,in conjunction with the address range to which the module has beenloaded, STEP 1804. The stored value may then be returned for aparticular function or stored in a TOC cache for later retrieval, etc.

In one embodiment, when the tracking structure is, e.g., an in-memorystructure, and a TOC value is not found in the TOC cache, control istransferred to software using, e.g., an interrupt, or user-mode eventbased branch. The software handler then reloads the value, e.g., byaccessing the in-memory structure storing the address range and TOCvalue corresponding to each module. In another embodiment, the in-memoryTOC structure is architecturally defined and a hardware handler reloadsthe TOC cache directly from the in-memory structure. In one embodiment,the software handler reloads both the TOC cache and the in-memorystructure when loading a module. Other variations are possible.

In accordance with a further aspect of the present invention, aread-only TOC register and TOC addressing modes are included in aninstruction set architecture (ISA). The read-only TOC register is, forinstance, a pseudo or virtual register that provides a TOC value for agiven module (e.g., by accessing a TOC cache or an in-memory table).That is, it is not a hardware or architected register and does not havestorage backing it, but, instead provides a TOC value to be used when,e.g., a selected register number is referenced. The TOC value isinitialized from, for example, a value stored in a TOC base table thatmay be loaded in conjunction with module initialization. A TOC basetable can correspond to one or more of a TOC cache of FIGS. 14 and 16,or an in-memory structure. Yet other formats can be used to store andprovide a TOC base value at a given instruction address in conjunctionwith one or more aspects of the present invention.

One example of using a read-only TOC register is described withreference to FIG. 19. As shown, a read-only TOC register 1900, referredto herein as TOCbase, is a pointer to a location in a TOC 1902. TOC 1902includes one or more variable addresses 1904 indicating the location ofa corresponding variable holding variable values 1906. The read-only TOCregister, TOCbase, is referenced by an addressing mode or is implicit inan instruction or as a prefix. The processor performs a TOC valuelook-up responsive to the TOCbase being specified as the addressing modeor as a register of an addressing mode, and the obtained TOC value isused in lieu of a value provided by a general purpose register specifiedas a base register.

In one embodiment, when there are provided n bits to encode 2^(n)registers in an instruction set, one of the 2^(n) register numbers isdefined to refer to the value of the TOC pointer, and when that registeris specified, the value of the TOC pointer is used as a value for theregister.

In further aspects, various instructions are provided that may use aread-only register. For instance, various load TOC-Relative Longinstructions are provided, as described with reference to FIGS. 20A-20C,and one or more Load Address TOC-Relative Long instructions may beprovided, an example of which is described with reference to FIG. 21.Other examples are also possible.

As shown in FIG. 20A, a Load TOC-Relative Long instruction 2000 includesa plurality of operation code (opcode) fields 2002 a, 2002 b includingan opcode specifying a Load TOC-Relative Long (LTL) operation; a firstoperand field (R₁) 2004 to indicate a location (e.g., register) of afirst operand; and a second operand field (RI₂) 2008 that is animmediate field, the contents of which are used as a signed binaryinteger designating one of bytes, halfwords, words, double words, etc.that are added to the value of the TOC pointer at the presentinstruction address to form the address of the second operand in storage(the TOC is defined by external means—e.g., using a program loader, anSTR instruction, a TOC table, a TOC cache, etc.).

Other embodiments of Load TOC-Relative Long instructions are alsoprovided, as depicted in FIGS. 20B-20C. Each Load TOC-Relative Longinstruction (LGTL) 2010 (FIG. 20B) and LGFTL 2020 (FIG. 20C) includesopcode fields 2012 a, 2012 b; 2022 a, 2022 b; a first operand field (R₁)2014, 2024 to indicate a location (e.g., register) of a first operand;and a second operand field (R₂) 2018, 2028 that is an immediate field,the contents of which are used as a signed binary integer designatingone of bytes, halfwords, words, double words, etc. that are added to thevalue of the TOC pointer at the present instruction address to form theaddress of the second operand in storage (the TOC is defined by externalmeans—e.g., using a program loader, an STR instruction, a TOC table, aTOC cache, etc.).

The second operand is placed unchanged at the first operand location,except that, for Load TOC Relative Long (LGFTL), it is sign extended.

For Load TOC-Relative Long (LTL), the operands are, e.g., 32 bits, andfor Load TOC-Relative Long (LGTL), the operands are 64 bits. For LoadTOC-Relative Long (LGFTL), the second operand is treated as a 32-bitsigned binary integer and the first operand is treated as a 64-bitsigned binary integer.

When DAT is on, the second operand is accessed using the sameaddressing-space mode as that used to access the instruction. When DATis off, the second operand is accessed using a real address.

For Load TOC-Relative Long (LTL, LGFTL), the second operand is to bealigned on a word boundary, and for Load TOC-Relative Long (LGTL), thesecond operand is aligned on a doubleword boundary; otherwise, aspecification exception may be recognized.

One example of a Load Address TOC-Relative Long instruction is describedwith reference to FIG. 21. As depicted, a Load Address TOC-Relative Longinstruction 2100 includes a plurality of operation code fields 2102 a,2102 b including an opcode that indicates a Load Address TOC-RelativeLong operation; a first operand field (R₁) 2104 to indicate a location(e.g., register) of a first operand; and a second operand field (R₂)2108 that is an immediate field, the contents of which are a signedbinary integer specifying the number of one of bytes, halfwords, words,double words, and so forth, that is added to value of the TOC pointer atthe current address to generate a computed address.

The address specified using the RI₂ field is placed in general registerR₁. The address is obtained by adding the RI₂ field to the value of theTOC at the current address.

In the 24-bit addressing mode, the address is placed in bit positions40-63, bits 32-39 are set to zeros, and bits 0-31 remain unchanged. Inthe 31-bit addressing mode, the address is placed in bit positions33-63, bit 32 is set to zero, and bits 0-31 remain unchanged. In the64-bit addressing mode, the address is placed in bit positions 0-63.

No storage references for operands take place, and the address is notinspected for access exceptions.

In a further aspect, a TOC add immediate shifted (tocaddis) instructionis provided (for, e.g., a RISC-style architecture). As depicted in FIG.22, in one example, a TOC add immediate shifted instruction 2200includes an operation code field 2202 including an opcode specifying aTOC add immediate shifted operation; a target return (RT) field 2204indicating a target return value; and a shift immediate (SI) field 2206specifying a shift amount to be applied to the TOC value.

As one example, the following defines tocaddis:

tocaddis RT,SI

RT<=(TOC)+EXTS (SI∥¹⁶0)

The sum TOC+(SI∥0x0000) is placed into register RT. EXTS refers toextended sign and ∥ refers to concatenation.

In a further aspect, TOC-indicating prefix instructions may be provided.For instance, an add TOC immediate shifted instruction, addtocis+, isprovided, which is a prefix instruction providing information for a nextinstruction. Referring to FIG. 23, in one example, an add TOC immediateshifted instruction 2300 includes, for instance, an operation code field2302 having an opcode specifying an add TOC immediate shifted operation;a target register (RT) field 2304 to hold a result; an operand field(RA) 2306; and a shift immediate (SI) field 2308.

As an example,

addtocis+ RT,RA,SI

if RA=0 then RT←(TOC)+EXTS (SI∥¹⁶0) else RT←(RA)+EXTS (SI∥¹⁶0)

The sum (RA|TOC)+(SI∥0x0000) is provided as a source for references toregister RT for the next sequential instruction only. addtocis+ is aninstruction prefix, and modifies the following instruction to use thevalue computed for RT as input when RT is specified. The instructionindicates that RT becomes unused after the next sequential instructionis executed and its value will be undefined. If execution is interruptedafter the addtocis+ instruction and prior to the next sequentialinstruction, the state will be updated in a manner to allow execution toresume with the next instruction and produce a correct result (i.e., RTwill be written, or another implementation-defined method for retainingthe effect of modifying the next sequential instruction's RT source willbe used). It is noted that addTOCis+ uses the value of TOCbase, not thecontents of GPR0, if RA=0.

The prefix instruction may have further options, such as a displacementspecifier field that indicates whether additional immediate bits are tobe used. Additionally, it may include one or more additional immediatefields that include values to be employed with (e.g., added to, OR'dwith, etc.) operands of the successor instruction.

Other prefix options may be used including a TOC prefix and/or a TOCprefix with an option to override a selectable one of the operands. Forinstance, a prefix instruction may be provided that indicates that a TOCvalue should be used instead of one of the operands of a successorinstruction. In one example, the operand is selectable.

Additionally, aspects of a prefix instruction (e.g., addtocis) and asubsequent instruction may be fused to facilitate processing. Forinstance, if a prefix instruction with a displacement is specified andthe subsequent instruction also includes a displacement, then thedisplacement may correspond to an immediate shifted and an immediatedisplacement. Other possibilities exist.

A particular optimization example using addtocis is shown below. In thisexample, an n (e.g., 3) instruction candidate sequence includes, forinstance: addtocis+ r4, toc, upper; addi r4, r4, lower; and lvx* vr2,r0, r4. This sequence may be represented in the following template:

i1 = addtocis+ <r1>, <r2>, <upper> i2 = addi <r1>, <r1>, <lower> i3 =lvx* <vrt>, r0, <r1>

=> and optimized to the following internal operation:

lvd <vrt>, toc_or_gpr(<r2>), combined (<upper>, <lower>)

The addtocis instruction is similar to addis, but introduces the valueof the TOC, rather than the constant 0, when the RA field has a value 0.In one example, lvx* is an instruction form that defines the baseregister (e.g., 4 in this example) as having an unspecified value afterexecution of the instruction. In one example, lvx* is a form of the lvx(load vector indexed) instruction indicating a last use of at least oneregister (e.g., defined herein to be the register indicated as <r1> inthe template). Lvd is a load vector operation with an implementeddefined displacement. The toc_or_gpr function handles expanding the TOCspecial case, since the lvd would otherwise handle the RA operandsimilar to all other RA operands as a 0 value representing 0, and theother register values representing the logical register.

Further opportunities may exist to reduce a complex sequence ofinstructions that includes a TOC instruction or a TOC-using instructioninto a simpler sequence of instructions.

One embodiment of an execution flow used to manage TOC operands isdescribed with reference to FIG. 24. In one example, a processor isexecuting this logic.

Referring to FIG. 24, in one example, an instruction is received, STEP2400. Any non-TOC operands of the instruction are obtained in accordancewith a non-TOC operand definition, STEP 2402. For instance, if aninstruction operand specifies a general purpose register, the data isobtained from that register, etc.

A determination is made as to whether a TOC operand is present in theinstruction, INQUIRY 2404. That is, is there a operand in theinstruction that explicitly or implicitly uses a TOC pointer? If a TOCoperand is present, then the TOC operand is obtained, as describedbelow, STEP 2406. Thereafter, or if a TOC operand is not present, anyobtained operand values are used in accordance with the instructiondefinition, STEP 2408. Optionally, one or more output operands arewritten, STEP 2410.

In one example, a TOC operand is obtained from an in-memory TOCstructure, as described with reference to FIG. 25. An address ofin-memory TOC tracking structure is obtained, STEP 2500, and from thein-memory TOC structure, a TOC value is obtained for the module thatincludes the instruction, STEP 2502. That TOC value is then provided foruse by the instruction, STEP 2504.

In another example, the TOC operand is obtained from a TOC cache, whichis backed by an in-memory structure, as described with reference to FIG.26. In this example, the TOC cache is accessed, STEP 2600, and adetermination is made as to whether there is a TOC cache hit, INQUIRY2602. That is, is there an entry in the cache for the module includingthe instruction? If there is not a TOC cache hit, then the TOC cache isreloaded from the in-memory TOC cache structure, STEP 2604. Thereafter,or if there is a TOC cache hit, the TOC value for the module thatincludes the instruction is obtained from the TOC cache and provided foruse by the instruction, STEP 2606.

A further example of obtaining the TOC operand from a TOC cache backedby an in-memory structure is described with reference to FIG. 27. Inthis example, the TOC cache is accessed, STEP 2700, and a determinationis made as to whether there is a TOC cache hit, INQUIRY 2702. If thereis a TOC cache hit, then the TOC value is retrieved from the entry inthe TOC cache corresponding to the module that includes the instructionand provided for use by the instruction, STEP 2704. If, however, thereis no TOC cache hit, then control is transferred to a software handler,STEP 2706. The software handler determines a TOC value using software(e.g., obtains it from an in-memory tracking structure), STEP 2710, andloads the determined TOC value into the TOC cache, STEP 2712. Thesoftware handler ends and the instruction is restarted, STEP 2714.

To load the TOC cache from software, a Load TOC Cache (LTC) instructionmay be used. For instance, LTC Rfrom, Rto, RTOC may be used to load anentry for <MODULE.Rfrom, MODULE.Rto, MODULE.TOC>. For instance, an entryis included in the cache and the address_from column is populated usingRfrom; the address_to column is populated using Rto; and the TOC valueis populated using RTOC. In one embodiment, an entry is selected inaccordance with a replacement policy of a particular implementation.

In another embodiment, a table entry is loaded by loading a plurality ofcontrol registers.

One example of a use case is described below:

char bar[MAX]; char foo(int idx) {  return bar[idx]; }

In accordance with the definition of the C programming language, thefunction foo returns a character from an array bar, in which thecharacter position is indicated by the argument idx to function foo.

In accordance with one aspect of the present invention, a compilertranslates this program to the following machine instruction sequence:

foo:  LDX R4, TOCbase, bar@toc // load starting address of bar from //TOC using TOC pointer specified // by “TOCbase” register  LBZX R3, R4,R3 // load byte from bar + idx  BLR // return from function foo

In accordance with one or more aspects of the present invention, a SetTOC Register instruction efficiently initializes a register to be loadedwith the TOC value. Further, in accordance with an aspect of the presentinvention, since a Set TOC Register instruction is efficient, a TOCregister value is not saved and restored in compiled code. Rather, whena subroutine is called, the TOC register value is abandoned. When acalled function returns, the TOC value is not loaded. Rather, a new SetTOC Register instruction is generated to load the TOC register.

One example of compiler generated code to obtain the correct value ofthe TOC pointer based on an STR (Set TOC Register) instructioncorresponding to the C program language function foo above is asfollows:

foo:  STR R4  LDX R4, TOC, bar@toc // load starting address of bar from// TOC using TOC pointer in R4  LBZX R3, R4, R3 // load byte from bar +idx  BLR // return from function foo

One embodiment of initializing a register with the TOC pointer, asperformed by the compiler, is described with reference to FIG. 28.Initially, a determination is made as to whether the function accessesthe TOC, INQUIRY 2800. If not, then processing is complete. However, ifthe function accesses the TOC, then a register is initialized with theTOC pointer using, for instance, an STR instruction, prior to first use,STEP 2802. For example, the STR instruction is added to the code beingcompiled and used to initialize the TOC register. Other variations arepossible.

In a further example, a static linker can initialize the TOC, asdescribed with reference to FIG. 29. In this example, a determination ismade as to whether the subroutine is being resolved to a function whichmay alter a register with the TOC value, INQUIRY 2900. If not, thenprocessing is complete. Otherwise, the register holding the TOC pointeris reinitialized with, e.g., an STR instruction, STEP 2902. For example,the STR instruction is added to the code being compiled and used toinitialize the TOC register. Other variations are possible.

An example use case is as follows. This more efficient code is generatedin accordance with an aspect of the present invention:

func( ) {   STR r2 // use instead of computing the TOC   ...   ... //USE r2   ... // no need to save TOC value on the stack   ...   g( );  ...   STR r2 // obtain TOC from STR instruction, instead of //reloading from stack   ...   ... // USE r2   ...

In addition to generating code with a TOC setting instruction, code maybe generated using TOC read-only registers. This further obviates a needto load a GPR with the TOC, and thereby, reduces register pressure andoverhead of loading the register, or of reloading it after a functioncall.

One example of compiler generated code to use a TOC read-only registeris as follows:

char bar[MAX]; char foo(int idx) {  return bar[idx]; }

In accordance with the definition of the C programming language, thefunction foo returns a character from an array bar, in which thecharacter position is indicated by the argument idx to function foo.

In accordance with one aspect of the present invention, a compilertranslates this program to the following machine instruction sequence.

foo:  LDX R4, TOCbase, bar@toc // load starting address of bar from //TOC using TOC pointer specified // by “TOCbase” register  LBZX R3, R4,R3 // load byte from bar + idx  BLR // return from function foo

One example of a compilation flow to use a TOC read-only register toreference the TOC is described with reference to FIG. 30. In thisexample, a determination is made as to whether a reference to the TOC isrequested, INQUIRY 3000. If not, then processing is complete. Otherwise,the TOC read-only register is used to reference the TOC, STEP 3002. Forinstance, an operation (e.g., an internal operation, an instruction,etc.) is included in the code being compiled and used to determine apointer to the TOC. Other variations are possible.

An example use case is as follows. This more efficient code is generatedin accordance with an aspect of the present invention:

func( ) { // no need to load r2 with TOC value   ...   LTL... // USETOCbase REGISTER AS OPERAND   ... // no need to save TOC value   ...  g( );   ... // no need to restore TOC value in r2   ...   LTL... //USE TOCbase REGISTER AS OPERAND   ...

One or more aspects of the present invention are inextricably tied tocomputer technology and facilitate processing within a computer,improving performance thereof. Further details of one embodiment offacilitating processing within a computing environment, as it relates toone or more aspects of the present invention, are described withreference to FIGS. 31A-31B.

Referring to FIG. 31A, in one embodiment, a subroutine is called from acalling module executing on a processor (3100). Based on calling thesubroutine, a value of a pointer to a reference data structure ispredicted (3102). The predicting is performed prior to executing asequence of one or more instructions in the subroutine to compute thevalue (3104). The value that is predicted is used to access thereference data structure to obtain a variable value for a variable ofthe subroutine (3106).

In a further aspect, a current value of the pointer is obtained prior tothe predicting (3108), and the current value is stored in a recoverylocation (3110). A determination is made, in one embodiment, that thevalue predicted for the pointer is incorrect (3112). Based ondetermining the value predicted for the pointer is incorrect, thecurrent value is obtained from the recovery location (3114).

As one example, the value predicted for the pointer is loaded in adefined location (3116). Further, in one example, the predictingincludes using a reference data structure pointer cache to obtain thevalue (3118).

In a further aspect, with reference to FIG. 31B, a determination is madeas to whether a current instruction in the subroutine corresponds to thesequence of one or more instructions to compute the value (3120). Basedon determining the current instruction corresponds to the sequence ofone or more instructions to compute the value, a check instruction tocheck the prediction of the value is inserted in the code (3122). Theinserting replaces the sequence of one or more instructions (3124).

In a further embodiment, a determination is made as to whether a checkindicator is set (3126). Based on determining the check indicator isset, a determination is made as to whether the current instructioncorresponds to the sequence of one or more instructions to compute thevalue (3128). Further, in one embodiment, based on determining thecurrent instruction does not correspond to the sequence of one or moreinstructions to compute the value, a determination is made as to whetherthe current instruction corresponds to a sequence of one or moreinstructions to use the value (3130). Based at least on determining thatthe current instruction corresponds to the sequence of one or moreinstructions to use the value, recovery is performed (3132).

As an example, the sequence of one or more instructions includes a loadinstruction (3134). Further in one embodiment, a current value of thepointer prior to the predicting is obtained (3136), and the currentvalue is stored in a rename register for use in recovery (3138).

Other variations and embodiments are possible.

Other types of computing environments may also incorporate and use oneor more aspects of the present invention, including, but not limited to,emulation environments, an example of which is described with referenceto FIG. 32A. In this example, a computing environment 20 includes, forinstance, a native central processing unit (CPU) 22, a memory 24, andone or more input/output devices and/or interfaces 26 coupled to oneanother via, for example, one or more buses 28 and/or other connections.As examples, computing environment 20 may include a PowerPC processor ora pSeries server offered by International Business Machines Corporation,Armonk, N.Y.; and/or other machines based on architectures offered byInternational Business Machines Corporation, Intel, or other companies.

Native central processing unit 22 includes one or more native registers30, such as one or more general purpose registers and/or one or morespecial purpose registers used during processing within the environment.These registers include information that represents the state of theenvironment at any particular point in time.

Moreover, native central processing unit 22 executes instructions andcode that are stored in memory 24. In one particular example, thecentral processing unit executes emulator code 32 stored in memory 24.This code enables the computing environment configured in onearchitecture to emulate another architecture. For instance, emulatorcode 32 allows machines based on architectures other than thez/Architecture, such as PowerPC processors, pSeries servers, or otherservers or processors, to emulate the z/Architecture and to executesoftware and instructions developed based on the z/Architecture.

Further details relating to emulator code 32 are described withreference to FIG. 32B. Guest instructions 40 stored in memory 24comprise software instructions (e.g., correlating to machineinstructions) that were developed to be executed in an architectureother than that of native CPU 22. For example, guest instructions 40 mayhave been designed to execute on a z/Architecture processor, butinstead, are being emulated on native CPU 22, which may be, for example,an Intel processor. In one example, emulator code 32 includes aninstruction fetching routine 42 to obtain one or more guest instructions40 from memory 24, and to optionally provide local buffering for theinstructions obtained. It also includes an instruction translationroutine 44 to determine the type of guest instruction that has beenobtained and to translate the guest instruction into one or morecorresponding native instructions 46. This translation includes, forinstance, identifying the function to be performed by the guestinstruction and choosing the native instruction(s) to perform thatfunction.

Further, emulator code 32 includes an emulation control routine 48 tocause the native instructions to be executed. Emulation control routine48 may cause native CPU 22 to execute a routine of native instructionsthat emulate one or more previously obtained guest instructions and, atthe conclusion of such execution, return control to the instructionfetch routine to emulate the obtaining of the next guest instruction ora group of guest instructions. Execution of native instructions 46 mayinclude loading data into a register from memory 24; storing data backto memory from a register; or performing some type of arithmetic orlogic operation, as determined by the translation routine.

Each routine is, for instance, implemented in software, which is storedin memory and executed by native central processing unit 22. In otherexamples, one or more of the routines or operations are implemented infirmware, hardware, software or some combination thereof. The registersof the emulated processor may be emulated using registers 30 of thenative CPU or by using locations in memory 24. In embodiments, guestinstructions 40, native instructions 46 and emulator code 32 may residein the same memory or may be disbursed among different memory devices.

As used herein, firmware includes, e.g., the microcode or Millicode ofthe processor. It includes, for instance, the hardware-levelinstructions and/or data structures used in implementation of higherlevel machine code. In one embodiment, it includes, for instance,proprietary code that is typically delivered as microcode that includestrusted software or microcode specific to the underlying hardware andcontrols operating system access to the system hardware.

A guest instruction 40 that is obtained, translated and executed may be,for instance, one of the instructions described herein. The instruction,which is of one architecture (e.g., the z/Architecture), is fetched frommemory, translated and represented as a sequence of native instructions46 of another architecture (e.g., PowerPC, pSeries, Intel, etc.). Thesenative instructions are then executed.

One or more aspects may relate to cloud computing.

It is understood in advance that although this disclosure includes adetailed description on cloud computing, implementation of the teachingsrecited herein are not limited to a cloud computing environment. Rather,embodiments of the present invention are capable of being implemented inconjunction with any other type of computing environment now known orlater developed.

Cloud computing is a model of service delivery for enabling convenient,on-demand network access to a shared pool of configurable computingresources (e.g. networks, network bandwidth, servers, processing,memory, storage, applications, virtual machines, and services) that canbe rapidly provisioned and released with minimal management effort orinteraction with a provider of the service. This cloud model may includeat least five characteristics, at least three service models, and atleast four deployment models.

Characteristics are as follows:

On-demand self-service: a cloud consumer can unilaterally provisioncomputing capabilities, such as server time and network storage, asneeded automatically without requiring human interaction with theservice's provider.

Broad network access: capabilities are available over a network andaccessed through standard mechanisms that promote use by heterogeneousthin or thick client platforms (e.g., mobile phones, laptops, and PDAs).

Resource pooling: the provider's computing resources are pooled to servemultiple consumers using a multi-tenant model, with different physicaland virtual resources dynamically assigned and reassigned according todemand. There is a sense of location independence in that the consumergenerally has no control or knowledge over the exact location of theprovided resources but may be able to specify location at a higher levelof abstraction (e.g., country, state, or datacenter).

Rapid elasticity: capabilities can be rapidly and elasticallyprovisioned, in some cases automatically, to quickly scale out andrapidly released to quickly scale in. To the consumer, the capabilitiesavailable for provisioning often appear to be unlimited and can bepurchased in any quantity at any time.

Measured service: cloud systems automatically control and optimizeresource use by leveraging a metering capability at some level ofabstraction appropriate to the type of service (e.g., storage,processing, bandwidth, and active user accounts). Resource usage can bemonitored, controlled, and reported providing transparency for both theprovider and consumer of the utilized service.

Service Models are as follows:

Software as a Service (SaaS): the capability provided to the consumer isto use the provider's applications running on a cloud infrastructure.The applications are accessible from various client devices through athin client interface such as a web browser (e.g., web-based email). Theconsumer does not manage or control the underlying cloud infrastructureincluding network, servers, operating systems, storage, or evenindividual application capabilities, with the possible exception oflimited user-specific application configuration settings.

Platform as a Service (PaaS): the capability provided to the consumer isto deploy onto the cloud infrastructure consumer-created or acquiredapplications created using programming languages and tools supported bythe provider. The consumer does not manage or control the underlyingcloud infrastructure including networks, servers, operating systems, orstorage, but has control over the deployed applications and possiblyapplication hosting environment configurations.

Infrastructure as a Service (IaaS): the capability provided to theconsumer is to provision processing, storage, networks, and otherfundamental computing resources where the consumer is able to deploy andrun arbitrary software, which can include operating systems andapplications. The consumer does not manage or control the underlyingcloud infrastructure but has control over operating systems, storage,deployed applications, and possibly limited control of select networkingcomponents (e.g., host firewalls).

Deployment Models are as follows:

Private cloud: the cloud infrastructure is operated solely for anorganization. It may be managed by the organization or a third party andmay exist on-premises or off-premises.

Community cloud: the cloud infrastructure is shared by severalorganizations and supports a specific community that has shared concerns(e.g., mission, security requirements, policy, and complianceconsiderations). It may be managed by the organizations or a third partyand may exist on-premises or off-premises.

Public cloud: the cloud infrastructure is made available to the generalpublic or a large industry group and is owned by an organization sellingcloud services.

Hybrid cloud: the cloud infrastructure is a composition of two or moreclouds (private, community, or public) that remain unique entities butare bound together by standardized or proprietary technology thatenables data and application portability (e.g., cloud bursting forloadbalancing between clouds).

A cloud computing environment is service oriented with a focus onstatelessness, low coupling, modularity, and semantic interoperability.At the heart of cloud computing is an infrastructure comprising anetwork of interconnected nodes.

Referring now to FIG. 33, illustrative cloud computing environment 50 isdepicted. As shown, cloud computing environment 50 comprises one or morecloud computing nodes 10 with which local computing devices used bycloud consumers, such as, for example, personal digital assistant (PDA)or cellular telephone 54A, desktop computer 54B, laptop computer 54C,and/or automobile computer system 54N may communicate. Nodes 10 maycommunicate with one another. They may be grouped (not shown) physicallyor virtually, in one or more networks, such as Private, Community,Public, or Hybrid clouds as described hereinabove, or a combinationthereof. This allows cloud computing environment 50 to offerinfrastructure, platforms and/or software as services for which a cloudconsumer does not need to maintain resources on a local computingdevice. It is understood that the types of computing devices 54A-N shownin FIG. 33 are intended to be illustrative only and that computing nodes10 and cloud computing environment 50 can communicate with any type ofcomputerized device over any type of network and/or network addressableconnection (e.g., using a web browser).

Referring now to FIG. 34, a set of functional abstraction layersprovided by cloud computing environment 50 (FIG. 33) is shown. It shouldbe understood in advance that the components, layers, and functionsshown in FIG. 34 are intended to be illustrative only and embodiments ofthe invention are not limited thereto. As depicted, the following layersand corresponding functions are provided:

Hardware and software layer 60 includes hardware and softwarecomponents.

Examples of hardware components include mainframes 61; RISC (ReducedInstruction Set Computer) architecture based servers 62; servers 63;blade servers 64; storage devices 65; and networks and networkingcomponents 66. In some embodiments, software components include networkapplication server software 67 and database software 68.

Virtualization layer 70 provides an abstraction layer from which thefollowing examples of virtual entities may be provided: virtual servers71; virtual storage 72; virtual networks 73, including virtual privatenetworks; virtual applications and operating systems 74; and virtualclients 75.

In one example, management layer 80 may provide the functions describedbelow. Resource provisioning 81 provides dynamic procurement ofcomputing resources and other resources that are utilized to performtasks within the cloud computing environment. Metering and Pricing 82provide cost tracking as resources are utilized within the cloudcomputing environment, and billing or invoicing for consumption of theseresources. In one example, these resources may comprise applicationsoftware licenses. Security provides identity verification for cloudconsumers and tasks, as well as protection for data and other resources.User portal 83 provides access to the cloud computing environment forconsumers and system administrators. Service level management 84provides cloud computing resource allocation and management such thatrequired service levels are met. Service Level Agreement (SLA) planningand fulfillment 85 provide pre-arrangement for, and procurement of,cloud computing resources for which a future requirement is anticipatedin accordance with an SLA.

Workloads layer 90 provides examples of functionality for which thecloud computing environment may be utilized. Examples of workloads andfunctions which may be provided from this layer include: mapping andnavigation 91; software development and lifecycle management 92; virtualclassroom education delivery 93; data analytics processing 94;transaction processing 95; and table of contents pointer processing 96.

The present invention may be a system, a method, and/or a computerprogram product at any possible technical detail level of integration.The computer program product may include a computer readable storagemedium (or media) having computer readable program instructions thereonfor causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, configuration data for integrated circuitry, oreither source code or object code written in any combination of one ormore programming languages, including an object oriented programminglanguage such as Smalltalk, C++, or the like, and procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The computer readable program instructions may executeentirely on the user's computer, partly on the user's computer, as astand-alone software package, partly on the user's computer and partlyon a remote computer or entirely on the remote computer or server. Inthe latter scenario, the remote computer may be connected to the user'scomputer through any type of network, including a local area network(LAN) or a wide area network (WAN), or the connection may be made to anexternal computer (for example, through the Internet using an InternetService Provider). In some embodiments, electronic circuitry including,for example, programmable logic circuitry, field-programmable gatearrays (FPGA), or programmable logic arrays (PLA) may execute thecomputer readable program instructions by utilizing state information ofthe computer readable program instructions to personalize the electroniccircuitry, in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

In addition to the above, one or more aspects may be provided, offered,deployed, managed, serviced, etc. by a service provider who offersmanagement of customer environments. For instance, the service providercan create, maintain, support, etc. computer code and/or a computerinfrastructure that performs one or more aspects for one or morecustomers. In return, the service provider may receive payment from thecustomer under a subscription and/or fee agreement, as examples.Additionally or alternatively, the service provider may receive paymentfrom the sale of advertising content to one or more third parties.

In one aspect, an application may be deployed for performing one or moreembodiments. As one example, the deploying of an application comprisesproviding computer infrastructure operable to perform one or moreembodiments.

As a further aspect, a computing infrastructure may be deployedcomprising integrating computer readable code into a computing system,in which the code in combination with the computing system is capable ofperforming one or more embodiments.

As yet a further aspect, a process for integrating computinginfrastructure comprising integrating computer readable code into acomputer system may be provided. The computer system comprises acomputer readable medium, in which the computer medium comprises one ormore embodiments. The code in combination with the computer system iscapable of performing one or more embodiments.

Although various embodiments are described above, these are onlyexamples. For example, computing environments of other architectures canbe used to incorporate and use one or more embodiments. Further,different instructions or operations may be used. Additionally,different registers may be used and/or other types of indications (otherthan register numbers) may be specified. Many variations are possible.

Further, other types of computing environments can benefit and be used.As an example, a data processing system suitable for storing and/orexecuting program code is usable that includes at least two processorscoupled directly or indirectly to memory elements through a system bus.The memory elements include, for instance, local memory employed duringactual execution of the program code, bulk storage, and cache memorywhich provide temporary storage of at least some program code in orderto reduce the number of times code must be retrieved from bulk storageduring execution.

Input/Output or I/O devices (including, but not limited to, keyboards,displays, pointing devices, DASD, tape, CDs, DVDs, thumb drives andother memory media, etc.) can be coupled to the system either directlyor through intervening I/O controllers. Network adapters may also becoupled to the system to enable the data processing system to becomecoupled to other data processing systems or remote printers or storagedevices through intervening private or public networks. Modems, cablemodems, and Ethernet cards are just a few of the available types ofnetwork adapters.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting. As used herein, thesingular forms “a”, “an” and “the” are intended to include the pluralforms as well, unless the context clearly indicates otherwise. It willbe further understood that the terms “comprises” and/or “comprising”,when used in this specification, specify the presence of statedfeatures, integers, steps, operations, elements, and/or components, butdo not preclude the presence or addition of one or more other features,integers, steps, operations, elements, components and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below, if any, areintended to include any structure, material, or act for performing thefunction in combination with other claimed elements as specificallyclaimed. The description of one or more embodiments has been presentedfor purposes of illustration and description, but is not intended to beexhaustive or limited to in the form disclosed. Many modifications andvariations will be apparent to those of ordinary skill in the art. Theembodiment was chosen and described in order to best explain variousaspects and the practical application, and to enable others of ordinaryskill in the art to understand various embodiments with variousmodifications as are suited to the particular use contemplated.

What is claimed is:
 1. A computer-implemented method of facilitatingprocessing within a computing environment, the computer-implementedmethod comprising: calling a subroutine from a calling module executingon a processor; predicting, based on calling the subroutine, a value ofa pointer to a reference data structure, the predicting being performedprior to executing a sequence of one or more instructions in thesubroutine to compute the value of the pointer; determining whether acurrent instruction in the subroutine corresponds to the sequence of oneor more instructions to compute the value of the pointer; inserting inthe code, based on determining the current instruction corresponds tothe sequence of one or more instructions to compute the value, a singlecheck instruction to check the prediction of the value, the insertingreplacing the sequence of one or more instructions, wherein instructionsto compute the value of the pointer are replaced by the single checkinstruction; and using the value that is predicted to access thereference data structure to obtain a variable value for a variable ofthe subroutine.
 2. The computer-implemented method of claim 1, furthercomprising: obtaining a current value of the pointer prior to thepredicting; and storing the current value in a recovery location.
 3. Thecomputer-implemented method of claim 2, further comprising: determiningthat the value predicted for the pointer is incorrect; and obtaining,based on determining the value predicted for the pointer is incorrect,the current value from the recovery location.
 4. Thecomputer-implemented method of claim 1, further comprising loading thevalue predicted for the pointer in a defined location.
 5. Thecomputer-implemented method of claim 1, further comprising: determiningwhether a check indicator is set; and determining whether the currentinstruction corresponds to the sequence of one or more instructions tocompute the value, based on determining the check indicator is set. 6.The computer-implemented method of claim 1, further comprising:determining, based on determining the current instruction does notcorrespond to the sequence of one or more instructions to compute thevalue, whether the current instruction corresponds to a sequence of oneor more instructions to use the value; and performing recovery, based atleast on determining that the current instruction corresponds to thesequence of one or more instructions to use the value.
 7. Thecomputer-implemented method of claim 1, wherein the sequence of one ormore instructions comprises a load instruction.
 8. Thecomputer-implemented method of claim 1, further comprising: obtaining acurrent value of the pointer prior to the predicting; and storing thecurrent value in a rename register for use in recovery.
 9. Thecomputer-implemented method of claim 1, wherein the predicting comprisesusing a reference data structure pointer cache to obtain the value. 10.The computer-implemented method of claim 1, further comprising:determining using the single check instruction whether the value that ispredicted is correct; and performing the using based on determining thatthe value that is predicted is correct.